package com.googlecode.maurersmarbles;

import java.util.List;

import android.graphics.Point;
import android.graphics.Rect;

public abstract class CardsDisplay {

	/**
	 * The maximum number of cards that can be displayed at once.
	 */
	protected static final int MAX_NUMBER_OF_CARDS = 5;
	/**
	 * The height of a card.
	 */
	protected double cardHeight;
	/**
	 * The width of a card.
	 */
	protected double cardWidth;
	/**
	 * The bounding box for the cards display.
	 */
	protected Rect outerRect = new Rect();

	/**
	 * Creates a new CardsDisplay.
	 */
	public CardsDisplay() {
		// do nothing
	}

	/**
	 * Returns the card height.
	 * @return the card height
	 */
	public double getCardHeight() {
		return cardHeight;
	}

	/**
	 * Returns the card width.
	 * @return the card width
	 */
	public double getCardWidth() {
		return cardWidth;
	}

	/**
	 * Sets the location and size of the cards display.
	 * @param startX the start x location of the cards display
	 * @param startY the start y location of the cards display
	 * @param width the width of the cards display
	 * @param height the height of the cards display
	 */
	public void setLocationAndSize(int startX, int startY, int width, int height) {
		outerRect.set(startX, startY, startX + width, startY + height);
	}

	/**
	 * Returns the card at the given screen x/y location, or null if no card.
	 * @param x the x location on the screen
	 * @param y the y location on the screen
	 * @return the card at the given screen x/y location, or null if no card
	 */
	public abstract Card getCardAtScreenXY(int x, int y);

	/**
	 * Returns the x/y value for each corner of the card on the screen, or null
	 * if no card. The order of the corners is UL, UR, LR, LL.
	 * @param card the card to get the corners for
	 * @return the x/y value for each corner of the card on the screen, or null
	 *         if no card
	 */
	public abstract Point[] getCardCornersOnScreen(Card card);

	/**
	 * Sets the cards to display.
	 * @param cards the cards to display
	 */
	public abstract void setCards(List<Card> cards);

}
